﻿package mortal.game.view.copy
{
    import com.gengine.global.*;
    import mortal.game.view.task.*;

    public class CopyInfo_TaskTrackConnector extends Object
    {
        private static var _copy:CopyInfoPanelBase;
        private static var _task:TaskTrackModuleNew;

        public function CopyInfo_TaskTrackConnector()
        {
            return;
        }// end function

        public static function registerCopy(param1:CopyInfoPanelBase) : void
        {
            _copy = param1;
            return;
        }// end function

        public static function unregisterCopy() : void
        {
            _copy = null;
            if (_task != null)
            {
                _task.stageResize();
            }
            return;
        }// end function

        public static function registerTaskTrack(param1:TaskTrackModuleNew) : void
        {
            _task = param1;
            return;
        }// end function

        public static function updateLaout(param1:Boolean = false) : void
        {
            if (_copy != null)
            {
                if (_copy.isExpanding && _copy.height >= 450 && _copy.height + 172 > Global.stage.stageHeight)
                {
                    _copy.y = (Global.stage.stageHeight - _copy.height) * 0.5;
                }
                else
                {
                    _copy.y = 172;
                }
                _copy.x = Global.stage.stageWidth - _copy.width;
            }
            if (_task != null)
            {
                _task.y = 179;
                _task.x = Global.stage.stageWidth - _task.width;
            }
            if (_copy == null || _task == null)
            {
                return;
            }
            if (param1)
            {
                if (_copy.isExpanding)
                {
                    _task.hideTrackExceptBtn(true);
                }
            }
            else if (_task.isExpanding)
            {
                _copy.unExpandHandler();
            }
            if (_copy.isExpanding && !_task.isExpanding)
            {
                _copy.x = Global.stage.stageWidth - _copy.width - 30;
                _task.x = Global.stage.stageWidth - _task.width;
            }
            else if (!_copy.isExpanding && !_task.isExpanding)
            {
                _copy.x = Global.stage.stageWidth - _copy.width - 23;
                _task.x = Global.stage.stageWidth - _task.width;
            }
            else
            {
                _copy.x = Global.stage.stageWidth - _copy.width;
                _task.x = Global.stage.stageWidth - _task.width - 30;
            }
            return;
        }// end function

    }
}
